import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {

	id?: number,
	projectId?: number,
	productId?: number,
	productName?: string,
	taskName?: string,
	projectName?: string,
	status?: number,
	cycle?: number,
  planTask:any,
	deviceIds?: string,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/business/task/v2/tasks';
const Url = '/business/task/v2/task';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};
//任务设备管理 
export const taskdevice = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", "/business/task/v2/task/device", {
    params
  });
};
//左侧树状
export const facilitbuildings = (params?: object) => {
  return http.request<commonResult<any>>("get", "/business/project/facilit/v2/buildings", {
    params
  });
};
//删除管理设备 
export const deletetaskdevice = (data?: object) => {
  return http.request<commonResult<any>>("delete", "/business/task/v2/task-device", {
    data
  });
};
//添加管理设备 
export const addtaskdevice = (data?: object) => {
  return http.request<commonResult<any>>("post", "/business/task/v2/task-device", {
    data
  });
};